<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/5/11 0011
  Time: 16:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="../../inc/header.jsp"></jsp:include>
<!-- Page Heading Section Start -->
<div class="page-heading-section section bg-parallax" data-bg-image="<%=path%>/assets/images/bg/bg-1.jpg" data-overlay="50">
    <div class="container">
        <div class="page-heading-content text-center">
            <h2 class="title">公司的HR列表</h2>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="<%=path%>/web/index">网站首页</a></li>
            </ol>
        </div>
    </div>
</div>
<!-- Page Heading Section End -->
<!-- Job Search Section Start -->
<div class="job-search-section section">
    <div class="container">
        <div class="job-search-wrap">

            <!-- Job Search Form Start -->
            <div class="job-search-form">
                <form action="<%=path%>/web/company/manage/hr/hrSearch" id="myform" method="post">
                    <div class="row mb-n4">
                        <div class="col-lg-auto col-sm-6 col-12 flex-grow-1 mb-4">
                            <input type="email" name="email" id="email" placeholder="输入邮箱查询">
                        </div>
                        <div class="col-lg-auto col-sm-6 col-12 flex-grow-1 mb-4">
                            <span id="titleMsg"></span>
                        </div>
                        <div class="col-lg-auto col-sm-6 col-12 flex-grow-1 mb-4">
                            <input type="submit" id="btn" class="btn btn-primary" value="查询"></input>
                        </div>
                    </div>
                </form>
            </div>
            <!-- Job Search Form End -->

        </div>
    </div>
</div>
<!-- Job Search Section End -->
<!-- Recent Jobs Start -->
<div class="section section-padding">
    <div class="container">
        <!-- Job List Wrap Start -->
        <div class="job-list-wrap">

            <!-- Job List Start -->
            <a class="job-list">
                <c:if test="${result eq 'ntexist'}">
                    <h6 class="title" style="color: red">未找到该用户</h6>
                </c:if>
                <c:if test="${result eq 'exist'}">
                    <h6 class="title" style="color: red">该用户已注册HR</h6>
                </c:if>
                <c:if test="${hr ne null}">
                    <div class="company-logo col-auto">
                        <img src="<%=path%>/assets/images/companies/company-1.png" alt="Company Logo">
                    </div>
                    <div class="salary-type col-auto order-sm-3">
                        <div class="btns">
                            <button type="button" id="mybtn" data-id="${hr.id}" class="badge badge-success">添加HR身份</button>
                        </div>
                    </div>
                    <div class="content col">
                        <h6 class="title">${hr.name}</h6>
                        <ul class="meta">
                            <li><strong class="text-primary">HR</strong></li>
                            <li><strong class="text-primary">邮箱：</strong></li>
                            <li>${hr.email}</li>
                            <li><strong class="text-primary">手机号：</strong></li>
                            <li>${hr.phone}</li>
                        </ul>
                    </div>
                </c:if>
            </a>
            <!-- Job List Start -->

        </div>
        <!-- Job List Wrap Start -->


    </div>
</div>
<!-- Recent Jobs End -->
<script type="text/javascript" src="<%=path%>/assets/js/vendor/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#mybtn").click(function () {
            var data_id = $(this).attr("data-id");
            $.ajax({
                url:"<%=path%>/web/company/manage/hr/hrAdd",
                data:"id="+data_id,
                type:"post",
                success:function (message) {
                    if("success"==message){
                        $(".job-list").html("<h6 class=\"title\" style=\"color: lawngreen\">添加成功</h6>");
                    }
                }
            });
        });
    });
</script>
<jsp:include page="../../inc/footer.jsp"></jsp:include>